package com.lan.mall.consumer.hystrix;

import com.lan.mall.common.utils.R;
import com.lan.mall.consumer.feign.UserService;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserServiceFallBackFactory implements FallbackFactory<UserService> {
    @Override
    public UserService create(Throwable throwable) {
        return new UserService() {
            @Override
            public R getUser(String appName) {
                return R.timeOut();
            }

            @Override
            public R providerHello() {
                return R.timeOut();
            }
        };
    }
}
